home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Resources
/
PaperCut Quota 6.1
/
pc-setup.exe
/
{app}
/
WebAdmin
/
UserList.asp
< prev
Wrap
Text File
|
2005-08-17
|
11KB
|
322 lines
<%@ Language=VBScript %>
<!-- #INCLUDE FILE="includes/PCCommon.inc" -->
<%
Sub RedirectToUserSearch
Response.Clear
Response.Redirect "UserList.asp"
End Sub
Dim objPCWeb
Set objPCWeb = CreateObject("PCWebAdmin.PCWebUsers")
If objPCWeb.Error Then
WriteErrorMessage objPCWeb.ErrorDescription
End If
if Trim(Request("strUserName")) <> "" then
'''''''''''''''''''''''''''''''''''''''
''''' Start of User Detail Screen '''''
'''''''''''''''''''''''''''''''''''''''
Dim strUserName
Dim strComment
strComment = Trim(Request("txtComment"))
strUserName = Trim(Request("strUserName"))
if (strUserName = "") then
' No username, send them back to the search page
RedirectToUserSearch
end if
' Check for refund call... if so then process
If Request("cmd") = "refund" Then
Dim curAmount
Dim lngJobEntryID
curAmount = CCur(Trim(Request("curAmount")))
lngJobEntryID = CLng(Trim(Request("lngJobEntryID")))
If objPCWeb.RefundUser(strUserName, curAmount, lngJobEntryID, GetText("RefundComment")) Then
RedirectWithMessage "UserList.asp?strUserName=" & strUserName, GetText("RefundSuccess")
Else
gstrErrorMessage = GetText("RefundFailure") & " " & objPCWeb.ErrorDescription
End If
End If
%>
<!--#include file="includes/header.inc" -->
<%
' Find the details of the user
Dim intRet
intRet = objPCWeb.SeekUser(strUserName)
if intRet > 0 then
' No match. Send them back to the search page.
RedirectToUserSearch
end if
if (Request("blnSubmitted") <> "") then
' Save changes.
if (Request("lstUnrestricted") = "Unrestricted") then
objPCWeb.Unrestricted = true
else
objPCWeb.Unrestricted = false
end if
' Update credit if an "Add" button was pressed.
if (IsNumeric(Request("txtCredit"))) then
' Didn't click an add $ button or adjustment, so set the credit to what the user selected
'Response.Write "Credit!!!"
objPCWeb.SetCredit CDbl(Request("txtCredit")), strComment
end if
strComment = ""
elseif (Request("blnAdjustmentSubmitted") <> "") then
' Save changes.
if (Request("cmdAddOne") <> "") then
objPCWeb.SetCredit objPCWeb.GetCredit + 1.0, strComment
elseif (Request("cmdAddFive") <> "") then
objPCWeb.SetCredit objPCWeb.GetCredit + 5.0, strComment
elseif (Request("cmdAddTen") <> "") then
objPCWeb.SetCredit objPCWeb.GetCredit + 10.0, strComment
elseif (IsNumeric(Request("txtAdjustment"))) then
if CDbl(Request("txtAdjustment")) <> 0 then
objPCWeb.SetCredit objPCWeb.GetCredit + CDbl(Request("txtAdjustment")), strComment
end if
end if
strComment = ""
end if
%>
<h1><%=GetText("UserDetails")%></h1>
<P>
<% WriteUserAdminLinks(strUserName) %>
<FORM ACTION="UserList.asp" METHOD="POST" id=form1 name=form1>
<INPUT type="hidden" name=strUserName value="<%= strUserName%>">
<INPUT type="hidden" name=blnSubmitted value="T">
<TABLE class="webAdmin" width="500">
<TR class="evenRow">
<TH><%=GetText("Username")%>:</TH>
<TD><%= objPCWeb.UserName %></TD>
</TR>
<TR class="oddRow">
<TH><%=GetText("Credit")%>:</TH>
<TD>
<INPUT type="text" size=10 name=txtCredit value="<%= objPCWeb.CreditText %>">
</TD>
</TR>
<TR class="evenRow">
<TH><%=GetText("PagesPrinted")%>:</TH>
<TD><%= FormatNumber(objPCWeb.PagesPrinted, 0, true, false, true) %></TD>
</TR>
<% If gblnHasNetCharging Then %>
<TR class="oddRow">
<TH><%=GetText("NetDataUsed")%>:</TH>
<TD><%= objPCWeb.TotalMBText & " " & GetText("MBAbbr") %></TD>
</TR>
<TR class="evenRow">
<TH><%=GetText("NetTimeUsed")%>:</TH>
<TD><%= objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") %></TD>
</TR>
<% End If %>
<TR class="oddRow">
<TH><%=GetText("Privilege")%>:</TH>
<TD align=left>
<SELECT NAME=lstUnrestricted>
<% if objPCWeb.Unrestricted then %>
<OPTION VALUE="Unrestricted" SELECTED><%=GetText("Unrestricted")%>
<OPTION VALUE="Restricted"><%=GetText("Restricted")%>
<% else %>
<OPTION VALUE="Unrestricted"><%=GetText("Unrestricted")%>
<OPTION VALUE="Restricted" SELECTED><%=GetText("Restricted")%>
<% end if %>
</SELECT>
</TD>
</TR>
<TR class="evenRow">
<TH width="35%"><%=GetText("Comment")%>:</TH>
<TD>
<INPUT type="text" size="50" name="txtComment" maxlength="255" value="<%=Server.HTMLEncode(strComment)%>">
</TD>
</TR>
<TR>
<TD align=right colspan=2>
<a href="OtherCharges.asp?txtChargeUser=<%=Server.URLEncode(objPCWeb.UserName)%>"><%=GetText("OtherCharges")%></a>
<INPUT type="submit" value="<%=GetText("Save")%>" name=cmdSave>
</TD>
</TR>
</TABLE>
</FORM>
<FORM ACTION="UserList.asp" METHOD="POST" id=form2 name=form2>
<INPUT type="hidden" name=strUserName value="<%= strUserName%>">
<INPUT type="hidden" name=blnAdjustmentSubmitted value="T">
<TABLE class="webAdmin" width="500">
<TR>
<TD align=left colspan=2><b><%=GetText("AdjustCredit") %></b>
</TD>
</TR>
<TR class="evenOdd">
<TH width="35%"><%=GetText("Comment")%>:</TH>
<TD>
<INPUT type="text" size="50" name="txtComment" maxlength="255" value="<%=Server.HTMLEncode(strComment)%>">
</TD>
</TR>
<TR class="oddRow">
<TH><%=GetText("QuickAdd")%>:</TH>
<TD align=center>
<INPUT type="submit" value="<%=GetText("AddOne")%>" name=cmdAddOne>
<INPUT type="submit" value="<%=GetText("AddFive")%>" name=cmdAddFive>
<INPUT type="submit" value="<%=GetText("AddTen")%>" name=cmdAddTen>
</TD>
</TR>
<TR class="evenRow">
<TH><%=GetText("QuickAdjust")%>:</TH>
<TD>
<INPUT type="text" size=10 name=txtAdjustment value="<%=FormatCredit(0.0)%>">
<INPUT type="submit" value="<%=GetText("ApplyAdjustment")%>" name=cmdApplyAdjustment>
</TD>
</TR>
</TABLE>
</FORM>
<% WriteUserAdminLinks(strUserName) %>
<%
'''''''''''''''''''''''''''''''''''''
''''' End of User Detail Screen '''''
'''''''''''''''''''''''''''''''''''''
else
'''''''''''''''''''''''''''''''''''''
''''' Start of User List Screen '''''
'''''''''''''''''''''''''''''''''''''
%>
<!--#include file="includes/header.inc" -->
<h1><h1><%=GetText("UserList")%></h1></h1>
<FORM ACTION="UserList.asp" METHOD="POST">
<TABLE>
<TR>
<TD><B><%=GetText("JumpToUser")%> : </B></TD>
<TD>
<INPUT type="text" name=txtUserName value=>
</TD>
<TD align=right>
<INPUT type="submit" value="<%=GetText("Search")%>" name=cmdSearch>
</TD>
<TR>
</TABLE>
</FORM>
<%
Dim intRow
Dim intStartRecord
Dim intRecord
intRow = 1
if Trim(Request("txtUserName")) <> "" then
intStartRecord = objPCWeb.SeekUser(Trim(Request("txtUserName")))
if LCase(objPCWeb.UserName) = LCase(Trim(Request("txtUserName"))) then
Response.Redirect "UserList.asp?strUserName=" & Trim(Request("txtUserName"))
end if
' Normalise intStartRecord to a page boundary
intStartRecord = GetStartRecord(GetCurrentPage(intStartRecord), 99999999)
else
if Request("intStartRecord") = "" then
intStartRecord = 1
else
intStartRecord = Int(Request("intStartRecord"))
end if
end if
' Move to the first record to display
If Not objPCWeb.EOF Then
objPCWeb.MoveLast
End If
objPCWeb.MoveFirst
If intStartRecord > 1 Then
objPCWeb.Move intStartRecord-1
End If
Response.Write "<TABLE align=center width=""90%""><TR><TD align=right>"
DisplayPageNavigation "UserList.asp", intStartRecord, objPCWeb.RecordCount
Response.Write "</TD></TR>"
Response.Write "<TR><TD>"
Response.Write "<TABLE class=""webAdmin"" width=""100%"">" & vbCRLF
Response.Write "<TR>" & vbCRLF
Response.Write "<TH width=""20%"">" & GetText("Username") & "</TH>" & vbCRLF
Response.Write "<TH width=""15%"">" & GetText("Credit") & "</TH>" & vbCRLF
Response.Write "<TH width=""20%"">" & GetText("PagesPrinted") & "</TH>" & vbCRLF
If gblnHasNetCharging or gblnShowUserNetUsageTotals Then
Response.Write "<TH width=""10%"">" & GetText("NetDataUsed") & "</TH>" & vbCRLF
Response.Write "<TH width=""10%"">" & GetText("NetTimeUsed") & "</TH>" & vbCRLF
End If
Response.Write "<TH width=""22%"">" & GetText("Privilege") & "</TH>" & vbCRLF
Response.Write "</TR>" & vbCRLF
do while (not objPCWeb.EOF and intRow <= mintRECORDS_PER_PAGE)
Response.Write "<TR class=""" & RowClassHelper(intRow) & """>" & vbCRLF
Response.Write "<TD width=""20%""><A title=""" & GetText("ModifyUserCredit") & """ HREF=""UserList.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.UserName & "</A></TD>" & vbCRLF
if (objPCWeb.GetCredit() < 0) then
Response.Write "<TD align=right class=""creditNeg"" width=""15%"">" & objPCWeb.CreditText & "</TD>" & vbCRLF
else
Response.Write "<TD align=right class=""creditPos"" width=""15%"">" & objPCWeb.CreditText & "</TD>" & vbCRLF
end if
Response.Write "<TD align=right width=""20%""><A title=""" & GetText("ViewPrintLog") & """ HREF=""Log.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & FormatNumber(objPCWeb.PagesPrinted, 0, true, false, true) & "</A></TD>" & vbCRLF
If gblnHasNetCharging Then
Response.Write "<TD align=right width=""18%""><A title=""" & GetText("ViewNetUsage") & """ HREF=""NetLog.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.TotalMBText & " " & GetText("MBAbbr") & "</A></TD>" & vbCRLF
Response.Write "<TD align=right width=""18%""><A title=""" & GetText("ViewNetUsage") & """ HREF=""NetLog.asp?strUserName=" & Server.URLEncode(objPCWeb.UserName) & """>" & objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") & "</A></TD>" & vbCRLF
ElseIf gblnShowUserNetUsageTotals Then
Response.Write "<TD align=right width=""18%"">" & objPCWeb.TotalMBText & " " & GetText("MBAbbr") & "</TD>" & vbCRLF
Response.Write "<TD align=right width=""18%"">" & objPCWeb.TotalNetHoursText & " " & GetText("HoursAbbr") & "</TD>" & vbCRLF
End If
if (objPCWeb.Unrestricted) then
Response.Write "<TD align=center width=""22%"">" & GetText("Unrestricted") & "</TD>" & vbCRLF
else
Response.Write "<TD align=center width=""22%"">" & GetText("Restricted") & "</TD>" & vbCRLF
end if
Response.Write "</TR>" & vbCRLF
objPCWeb.MoveNext
intRow = intRow + 1
loop
Response.Write "</TABLE>" & vbCRLF
Response.Write "</TD></TR>" & vbCRLF
Response.Write "<TR><TD align=right>" & vbCRLF
DisplayPageNavigation "UserList.asp", intStartRecord, objPCWeb.RecordCount
Response.Write "</TD></TR></TABLE>" & vbCRLF
Set objPCWeb = nothing
end if
'''''''''''''''''''''''''''''''''''
''''' End of User List Screen '''''
'''''''''''''''''''''''''''''''''''
' Response.End
Set objPCWeb = nothing
%>
<!--#include file="includes/footer.inc" -->